package com.shqcjd.sinopecdemomobile.ui.adapter;

import android.graphics.Color;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shqcjd.sinopecdemomobile.R;
import com.shqcjd.sinopecdemomobile.model.pojo.EquipmentGroupBean;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class StateInspectionRecordItemAdapter extends BaseQuickAdapter<EquipmentGroupBean.EquipmentCheckListBean.EquipmentChildrenBeanX.EquipmentChildrenBean,StateInspectionRecordItemAdapter.ViewHolder> {

    public StateInspectionRecordItemAdapter(@Nullable List<EquipmentGroupBean.EquipmentCheckListBean.EquipmentChildrenBeanX.EquipmentChildrenBean> data) {
        super(R.layout.activity_state_inspection_item_item, data);
    }

    @Override
    protected void convert(StateInspectionRecordItemAdapter.ViewHolder helper, EquipmentGroupBean.EquipmentCheckListBean.EquipmentChildrenBeanX.EquipmentChildrenBean item) {
        helper.tvItemInspectionNameItem.setText(item.equipment_name);
        if(item.check_normal == 1){
            helper.tvItemInspectionStateItem.setText("正常");
            helper.tvItemInspectionStateItem.setTextColor(Color.parseColor("#363636"));
        }else if(item.check_normal == 2){
            helper.tvItemInspectionStateItem.setText("异常");
            helper.tvItemInspectionStateItem.setTextColor(Color.parseColor("#E12B2B"));
        }else if(item.check_normal == 0){
            helper.tvItemInspectionStateItem.setText("未巡检");
            helper.tvItemInspectionStateItem.setTextColor(Color.parseColor("#8e9296"));
        }

    }

    class ViewHolder extends BaseViewHolder {
        @BindView(R.id.tv_item_inspection_name_item)
        TextView tvItemInspectionNameItem;
        @BindView(R.id.tv_item_inspection_state_item)
        TextView tvItemInspectionStateItem;

        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }

}
